package com.ming.netty.inoutboundhandler;

import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.sctp.SctpChannel;
import io.netty.channel.socket.SocketChannel;

public class MyClientInitializer extends ChannelInitializer<SocketChannel> {
    @Override
    protected void initChannel(SocketChannel channel) throws Exception {

        ChannelPipeline pipeline = channel.pipeline();
        //加入一个出站的handler 对数据进行编码
        pipeline.addLast(new MyLongToByteEncoder());

//        pipeline.addLast(new MyByteToLongDecoder());//入站的解码器
        pipeline.addLast(new MyByteToLongDecoder2());

        //加入一个自定义的handler 处理逻辑
        pipeline.addLast(new MyClientHandler());
    }
}
